/*
* This file is part of the CXHWebImage package.
* (c) Olivier Poitrey <rs@dailymotion.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <ImageIO/ImageIO.h>
#import "CXHImageIOAnimatedCoder.h"

// AVFileTypeHEIC/AVFileTypeHEIF is defined in AVFoundation via iOS 11, we use this without import AVFoundation
#define kCXHUTTypeGIFHEIC  ((__bridge CFStringRef)@"public.heic")
#define kCXHUTTypeGIFHEIF  ((__bridge CFStringRef)@"public.heif")
// HEIC Sequence (Animated Image)
#define kCXHUTTypeGIFHEICS ((__bridge CFStringRef)@"public.heics")
// kCXHUTTypeGIFWebP seems not defined in public UTI framework, Apple use the hardcode string, we define them :)
#define kCXHUTTypeGIFWebP  ((__bridge CFStringRef)@"org.webmproject.webp")

#define kCXHUTTypeGIFImage ((__bridge CFStringRef)@"public.image")
#define kCXHUTTypeGIFJPEG  ((__bridge CFStringRef)@"public.jpeg")
#define kCXHUTTypeGIFPNG   ((__bridge CFStringRef)@"public.png")
#define kCXHUTTypeGIFTIFF  ((__bridge CFStringRef)@"public.tiff")
#define kCXHUTTypeGIFSVG   ((__bridge CFStringRef)@"public.svg-image")
#define kCXHUTTypeGIFGIF   ((__bridge CFStringRef)@"com.compuserve.gif")
#define kCXHUTTypeGIFPDF   ((__bridge CFStringRef)@"com.adobe.pdf")
#define kCXHUTTypeGIFBMP   ((__bridge CFStringRef)@"com.microsoft.bmp")
#define kCXHUTTypeGIFRAW   ((__bridge CFStringRef)@"public.camera-raw-image")

@interface CXHImageIOAnimatedCoder ()

+ (NSTimeInterval)frameDurationAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source;
+ (NSUInteger)imageLoopCountWithSource:(nonnull CGImageSourceRef)source;
+ (nullable UIImage *)createFrameAtIndex:(NSUInteger)index source:(nonnull CGImageSourceRef)source scale:(CGFloat)scale preserveAspectRatio:(BOOL)preserveAspectRatio thumbnailSize:(CGSize)thumbnailSize lazyDecode:(BOOL)lazyDecode animatedImage:(BOOL)animatedImage;
+ (BOOL)canEncodeToFormat:(CXHImageFormat)format;
+ (BOOL)canDecodeFromFormat:(CXHImageFormat)format;

@end
